<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>复杂图片展示</title>
    <style>
      .grid-container {
        width: 1000px;
        /* height: 620px; */
        display: inline-grid;
        /* 创建3行组合，行高 80px 200px 交替 */
        grid-template-rows: repeat(3, 80px 200px);
        /* 创建2列，第1列宽为200px，第2列宽自动 */
        grid-template-columns: 200px auto;
        /* 项目排列顺序-先列后行排列 */
        grid-auto-flow: column;
        /* 列间距都为 20px */
        column-gap: 20px;
      }

      .grid-item.header {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30px;
        font-weight: bold;
      }

      .grid-container .grid-item.list {
        display: grid;
        grid-template-rows: repeat(2, 1fr);
        grid-template-columns: repeat(2, 1fr);
        /*
        grid-template-rows:repeat(2,97.5px);
        grid-template-columns:repeat(2,97.5px);
        */
        /*强制单元格内的内容过大时，压缩而不是撑开*/
        /* 
        grid-template-rows:repeat(2,minmax(0,1fr));
        grid-template-columns:repeat(2,minmax(0,1fr)); 
        */
        gap: 5px;
      }

      .grid-container .grid-item.list .img {
        /* overflow: hidden; */
        /* 内部内容超过宽和高，则往内缩 */
        min-width: 0;
        min-height: 0;
      }

      .grid-container .grid-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .grid-item:nth-child(7) {
        grid-area: 1/2 / span 6/3;
      }
    </style>
  </head>
  <body>
    <div class="grid-container">
      <div class="grid-item header">帽子</div>
      <div class="grid-item list">
        <div class="img"><img src="https://picsum.photos/100?random=1" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=2" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=3" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=4" alt="image" /></div>
      </div>
      <div class="grid-item header">衣服</div>
      <div class="grid-item list">
        <div class="img"><img src="https://picsum.photos/100?random=5" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=6" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=7" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=8" alt="image" /></div>
      </div>
      <div class="grid-item header">裤子</div>
      <div class="grid-item list">
        <div class="img"><img src="https://picsum.photos/100?random=9" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=10" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=11" alt="image" /></div>
        <div class="img"><img src="https://picsum.photos/100?random=12" alt="image" /></div>
      </div>
      <!-- 大图 -->
      <div class="grid-item">
        <img src="https://picsum.photos/800?random=13" alt="image" />
      </div>
    </div>
  </body>
</html>
